define(["jquery","template","as/app/growth/growthDetail.servers","as/template/growth/growthDetail.tpl"],function($,template,$servers,tpl){
	var ui = {};

	var drawLoading = function (data) {
        return template("growthDetail_loading", data);
    }
    var drawHistory = function (data) {
        return template("growthDetail_history", data);
    }
    var drawInfo = function (data) {
        return template("growthDetail_info", data);
    }
    var drawTab = function (data) {
        return template("growthDetail_tab", data);
    }
    var drawrResult = function (data) {
        return template("growthDetail_result", data);
    }
    var drawrTrends = function (data) {
        return template("growthDetail_trends", data);
    }
    var drawrTrendsPrint = function (data) {
        return template("growthDetail_trendsPrint", data);
    }
    
    ui.loading = function (options) {
        $("#"+options.id).append(tpl.loading());
        var html = drawLoading(options);
        $("#"+options.id).append(html);
    };
    ui.history = function (options) {
        $("#"+options.id).html( tpl.history() );
        var html = drawHistory(options);
        $("#"+options.id).html(html);
    }
    ui.info = function (options) {
        $("#"+options.id).html( tpl.info() );
        var html = drawInfo($servers.handleInfo(options.data));
        $("#"+options.id).html(html);
    }
    ui.tab = function (options) {
        $("#"+options.id).html( tpl.tab() );
        var html = drawTab(options.data);
        $("#"+options.id).html(html);
    }
    ui.result = function (options) {
        $("#"+options.id).html( tpl.result() );
        var html = drawrResult(options.data);
        $("#"+options.id).html(html);
    }
    ui.trends = function (options) {
        $("#"+options.id).html( tpl.trends() );
        var html = drawrTrends(options.data);
        $("#"+options.id).html(html);
    }
    ui.trendsPrint = function (options) {
        $("#"+options.id).html( tpl.trendsPrint() );
        var html = drawrTrendsPrint(options.data);
        $("#"+options.id).html(html);
    }

	return ui;
});